#ifndef __losor_executor_h__
#define __losor_executor_h__

#include <list.h>
#include <windows.h>
#include "config.h"

#ifdef __cplusplus
extern "C"{
#endif

#define THREAD_NONE     0
#define THREAD_RUN      1
#define THREAD_STOP     2

typedef struct _exeinfo
{
    // 4 level priority: 0 > 1 > 2 > 3
    list* task[4];
    HANDLE thread[MAX_THREAD];
    int thread_event[MAX_THREAD];
} exeinfo;

void executor_init();
void executor_uninit();

int push_task( void *task, int priority );
int push_task_sys( void *task, int priority );
void* pop_task();

int set_thread_count( int count );
DWORD WINAPI thread_func( void* exe );

#ifdef __cplusplus
};
#endif

#endif // __losor_executor_h__
